package com.whli.jee.oa.config;

import com.whli.jee.oa.custom.CustomGroupEntityManagerFactory;
import com.whli.jee.oa.custom.CustomUserEntityManagerFactory;
import org.activiti.engine.impl.interceptor.SessionFactory;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * Activiti 扩展配置
 * @author qiaolin
 * @version 2018/10/22
 **/

@Configuration
public class ActivityConfig implements ProcessEngineConfigurationConfigurer{

    @Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
        processEngineConfiguration.setActivityFontName("宋体");
        processEngineConfiguration.setLabelFontName("宋体");
        processEngineConfiguration.setAnnotationFontName("宋体");
        processEngineConfiguration.setIdGenerator(new UuidGenerator());

        List<SessionFactory> mySession = new ArrayList<>();
        mySession.add(new CustomUserEntityManagerFactory());
        mySession.add(new CustomGroupEntityManagerFactory());
        processEngineConfiguration.setCustomSessionFactories(mySession);
    }
}
